package edu.sctu.zcy.month201506.day20150616;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;

/**
 * Created by user24 on 2015/6/16.
 */
public class HttpTest {

    URL url;
    public HttpTest(String path) {

        try {
            this.url = new URL(path);
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
    }

    public void setMethod(){

        try {
            HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
            System.out.println(httpURLConnection.getResponseMessage());
            System.out.println(httpURLConnection.getInstanceFollowRedirects());
            System.out.println(httpURLConnection.getPermission());
            System.out.println(httpURLConnection.getRequestMethod());
//            httpURLConnection.setRequestMethod("POST");
//            System.out.println(httpURLConnection.getRequestMethod());
            System.out.println(httpURLConnection.getResponseMessage());



        } catch (IOException e) {
            e.printStackTrace();
        }


    }
}
